#include <iostream>
#include <thread>
#include <mutex>
using namespace std;

volatile int counter = 0;
mutex mtx;
void func(){
    for(int i = 0;i < 10000;++i){
        mtx.lock();
        ++counter;
        mtx.unlock();
    }
}

int main()
{
    thread th[10];
    for(int i = 0;i < 10;++i){
        th[i] = thread(func);
    }
    for(auto &i : th){
        i.join();
    }
    cout << "over" << endl;
    cout << counter << endl;
    return 0;
}
